import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {
  id?: number,
  deviceId?:Number
  projectId?: number,
  monitorName?: String,
  protocol?: String,
  monitorSN?: String,
  portSN?: String,
  position?: Number,
  buildingId?: any,
  videoUrl?:string,
  drawingId?: String,
  drawingPoint?: any,
  markPoint?: any,
  lng?:any,
  lat?:any,
  area?:any,
  url?: string,
  place?:String,
  outsidePostion?:String,
  password?:any,
  channelsName?:any


}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/device/monitor/v2/videos';
const Url = '/business/device/monitor/v2/monitor';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};

export const settInfo  = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/setting", {
    params
  });
};
export const updateInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/device/monitor/v2/setting", {
    data
  });
};

/**
 * 2.8.1.3视频管理列表信息
 */
export const videomonitorsList = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/monitors", {
    params
  });
};

/**
 * 2.8.1.4添加监控设备
 */
export const videomonitorsadd = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/device/monitor/v2/monitor", {
    data
  });
};

/**
 * 2.8.1.7编辑监控设备信息回显
 */
export const videomonitorsInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/monitor", {
    params
  });
};

/**
 * 2.8.1.7编辑监控设备信息回显
 */
export const videomonitorsupdate = (data?: object) => {
  return http.request<commonResult<any>>("put", "/business/device/monitor/v2/monitor", {
    data
  });
};

/**
 * 2.8.1.5 删除监控设备
 */
export const videomonitorsdelete = (data?: object) => {
  return http.request<commonResult<any>>("delete", "/business/device/monitor/v2/monitor", {
    data
  });
};


/**
 * 2.8.1.8.1通道列表
 */
export const videomonitorschannels = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/channels", {
    params
  });
};

/**
 * 2.8.1.8.1通道列表
 */
export const videomonitorschannelsadd = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/device/monitor/v2/channels", {
    data
  });
};

/**
 * 2.8.1.8.6编辑通道回显
 */
export const videomonitorschannelsinfo = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/info", {
    params
  });
};


/**
 * 2.8.1.8.6编辑通道回显
 */
export const videomonitorschannelsupdate = (data?: object) => {
  return http.request<commonResult<any>>("put", "/business/device/monitor/v2/channels", {
    data
  });
};

/**
 * 2.8.1.8.4删除通道
 */
export const videomonitorschannelsdelete = (data?: object) => {
  return http.request<commonResult<any>>("delete", "/business/device/monitor/v2/channels", {
    data
  });
};


/**
 * 2.8.1.8.5播放
 */
export const videomonitorschannelsplay = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/device/monitor/v2/play", {
    data
  });
};
/**
 * 2.8.1.9获取监控对接信息
 */
export const joinDeviceInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", "/business/device/monitor/v2/sip", {
    params
  });
};